package top.italks.demo.mapper;

import org.apache.ibatis.annotations.Mapper;
import top.italks.demo.entity.WXOrderEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

/**
 * Mapper
 *
 * @Author: 陈忠波
 * @Date: 2019/09/10 04:13
 */
@Mapper
public interface WXOrderMapper {

    /**
     * 新增
     *
     * @param wxOrderEntity
     * @return 影响条数
     */
    @Insert({"INSERT INTO `pay_wxorder`(`body`,`detail`,`out_trade_no`,`total_fee`) VALUES (#{body},#{detail},#{out_trade_no},#{total_fee})"})
    int add(WXOrderEntity wxOrderEntity);

    /**
     * 根据 编号 修改
     *
     * @param wxOrderEntity
     * @return 影响条数
     */
    @Update({"UPDATE `pay_wxorder` SET `appid`=#{appid},`mch_id`=#{mch_id},`spbill_create_ip`=#{spbill_create_ip},`notify_url`=#{notify_url},`trade_type`=#{trade_type},`return_code`=#{return_code},`return_msg`=#{return_msg},`result_code`=#{result_code},`openid`=#{openid},`is_subscribe`=#{is_subscribe},`bank_type`=#{bank_type},`cash_fee`=#{cash_fee},`transaction_id`=#{transaction_id},`time_end`=#{time_end} WHERE `out_trade_no`=#{out_trade_no}"})
    int modifyByOutTradeNo(WXOrderEntity wxOrderEntity);

}
